package br.com.virtual.vender.dao.impl;

import br.com.virtual.base.dao.impl.BaseDaoImpl;
import br.com.virtual.vender.dao.ItemVendaDAO;
import br.com.virtual.vender.model.ItemVenda;

public class ItemVendaDAOImpl extends BaseDaoImpl implements ItemVendaDAO {

	@Override
	public ItemVenda create(ItemVenda itemVenda) {

		getManager().persist(itemVenda);
		return itemVenda;
	}

	@Override
	public ItemVenda read(Long id) {
		return getManager().find(ItemVenda.class, id);
	}

	@Override
	public void update(ItemVenda itemVenda) {
		getManager().merge(itemVenda);
	}

	@Override
	public void delete(ItemVenda itemVenda) {
		getManager().remove(read(itemVenda.getId()));
	}
}
